<?php
require_once dirname(__FILE__) . '/../../bootstrap/unit.php';

class unit_WidgetFormGenderTest extends sfPHPUnitBaseTestCase
{

  /**
   * @author Maximilian Lenkeit <dev@lenki.com>
   * @covers WidgetFormGender::__construct
   */
  public function testConstructShouldSetChoiceToArrayWithMaleAndFemaleKeys ()
  {
    $widget = new WidgetFormGender();
    $choices = $widget->getOption('choices');
    $this->assertEquals(2, count($choices));
    $this->assertArrayHasKey('male', $choices);
    $this->assertArrayHasKey('female', $choices);
  }

  /**
   * @author Maximilian Lenkeit <dev@lenki.com>
   * @covers WidgetFormGender::__construct
   */
  public function testConstructShouldOverwriteChoicesParameter ()
  {
    $choices = array('i' => 'ich', 'you' => 'du');
    $widget = new WidgetFormGender(array('choices' => $choices));
    $this->assertNotEquals($choices, $widget->getOption('choices'));
  }

  /**
   * @author Maximilian Lenkeit <dev@lenki.com>
   * @covers WidgetFormGender::__construct
   */
  public function testConstrctShouldSetMultipleOptionToFalse ()
  {
    $widget = new WidgetFormGender(array('multiple' => true));
    $this->assertFalse($widget->getOption('multiple'));
  }
}